Skip to content

own: a global array of constant arrays is no keeper; captured function values; constructor parameters past calls; borrows across releases of unrelated types (TSLANG 80, 82-84) - #858

Merged
ASDAlexander77 merged 5 commits into
mainfrom
fix-own-items-82
Nov 14, 2026
Merged

ASDAlexander77 merged 5 commits into
mainfrom
fix-own-items-82

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

More -mm=own fixes (TSLANG 80, 82, 83, 84, written up in TSLANG_ISSUES.md). 82 and 83 are the issues #857 recorded.

  • 83 (memory bug): a row of a module-level array of arrays bound to a local (const meta = POOL[idx]) was freed on each call: a double free, which hung at exit or crashed.
    • The global passed for a keeper, whose elements are immortal, because its literal's elements are constants. Its rows are constant arrays, each a block nothing makes immortal.
    • Such a global is no keeper now, so a row read is a borrow.
    • The new test, built with the old compiler, hangs at exit.
  • 82: a closure calling a function value it captured counted as a call that may free anything.
    • The call now resolves to the functions stored into the capture box's field, when every store is a function's symbol and no closure writes the box.
    • A captured let another closure assigns stays unknown.
  • 80: a constructor parameter stored into a field, then read in a loop that calls, is read from the field, when this never escapes the constructor (no call can reach the object).
  • 84: a borrow of a call's result, whose place is not known, survives a release of a value whose type cannot hold it (e.g. a texture across a pipeline store).
    • MLIRGen lists the module's @final classes, and its declared @cpp ones, on the module (ts.own_final_classes).
    • Only those classes' fields are followed: any other class may be a subclass object holding anything. The borrowed value must be of a @final class, or an array.
    • In the commit messages this fix was first numbered 82; it is 84 in the tests and docs.

Tests

  • Every model: 00tslang_issue_80, 00tslang_issue_82, 00tslang_issue_83, 00tslang_issue_84.
  • Own error tests:
    • own_err_escaped_this_field_read
    • own_err_closure_reassigned_captured_call
    • own_err_borrowed_result_holder_stored

Validation

  • ctest: 7435 of 7435 passed.
  • DefaultLib tests.ps1: all four models passed. Results are in a comment.
  • ntg sweep (my own-sweep-fixes branch): 101 errors before this batch, 96 after.

🤖 Generated with Claude Code

ASDAlexander77 and others added 5 commits November 14, 2026 21:01
…st calls, when `this` never escapes (TSLANG 80)

No call can reach an object the constructor only reads for its fields, so
none writes them; the pairing of the parameter with its field now sees past
calls there. No copy is made (a copy leaks the parameter the caller gave).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… hold it (TSLANG 82)

MLIRGen lists the module's @Final classes, and its declared @cpp ones, on
the module; dropsChain follows the released type's fields for a chain whose
places are not known, for a release and for a call whose drops are known
stores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… local is borrowed, not freed (TSLANG 83)

Its rows are blocks the literal makes, never made immortal, so a keeper's
read let a local own one and free it on each call (a double free: a hang at
exit or a crash).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e functions stored into it (TSLANG 82); the type-reachability fix is TSLANG 84

When every store into the captured value's box field is a function's
symbol, and the closures given the box write none of its fields, the call
resolves to those functions. TSLANG 82 is the issue main's TSLANG_ISSUES
numbers so; the release-type fix of the previous commit becomes 84.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77

Copy link
Copy Markdown
Owner Author

DefaultLib tests.ps1 (Windows, release + debug, compile + jit), built with this branch's head (1480fdf):

== gc
Finished release, compile : 224/225 passed, 1 skipped
Finished release, jit : 224/225 passed, 1 skipped
Finished debug, compile : 224/225 passed, 1 skipped
Finished debug, jit : 224/225 passed, 1 skipped
Done. All tests passed.
== none
Finished release, compile : 221/225 passed, 4 skipped
Finished release, jit : 221/225 passed, 4 skipped
Finished debug, compile : 221/225 passed, 4 skipped
Finished debug, jit : 221/225 passed, 4 skipped
Done. All tests passed.
== rc
Finished release, compile : 221/225 passed, 4 skipped
Finished release, jit : 221/225 passed, 4 skipped
Finished debug, compile : 221/225 passed, 4 skipped
Finished debug, jit : 221/225 passed, 4 skipped
Done. All tests passed.
== own
Finished release, compile : 219/225 passed, 6 skipped
Finished release, jit : 219/225 passed, 6 skipped
Finished debug, compile : 219/225 passed, 6 skipped
Finished debug, jit : 219/225 passed, 6 skipped
Done. All tests passed.

ctest: 100% tests passed, 0 tests failed out of 7435

@ASDAlexander77
ASDAlexander77 merged commit 0c8439c into main Nov 14, 2026
8 checks passed
@ASDAlexander77
ASDAlexander77 deleted the fix-own-items-82 branch November 14, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant